home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Cl…Business) - New Member 21 / Software of the Month Club XXI - New Member Business.ISO / mac / SOMCNMXXIBUS / DOS / BIZ / ASEASY / ASEASY.570 / ASEASY.USR < prev   
Text File  |  1995-07-03  |  8KB  |  246 lines

  1. ;---------------------------------------------------------------------------
  2. ;        ** AS-EASY-AS **  External Functions Definition File
  3. ;                     Copyright 1995, TRIUS, Inc.
  4. ;        TRIUS, Inc., P.O. Box 249, N. Andover, MA 01845-0249
  5. ;     Tel. 508-794-9377,   Fax. 508-688-6312,  BBS. 508-794-0762
  6. ;---------------------------------------------------------------------------
  7. ;  (1)  Each function definition is made up of TWO lines as described below:
  8. ;
  9. ;           1st Line: Function_Name, Number_Of_Variables
  10. ;           2nd Line: Algebraic_Expression 
  11. ;
  12. ;           The expression can use any of the AS-EASY-AS built-in 
  13. ;           functions.  The dynamic arguments of the external function
  14. ;           are refferred to, in the definition, as @A(n), where n
  15. ;           is an integer 1 to 10.
  16. ;
  17. ;           ex.   1st line:  ADD2NUM,2
  18. ;                 2nd line:  +@A(1)+@A(2)
  19. ;
  20. ;           This function simply adds the two variables passed to it. 
  21. ;           So, if inc cell B10 of AS-EASY-AS, the user entered
  22. ;           @ADD2NUM(2,6)  the result would be 6.      
  23. ;
  24. ;  (2)  The maximum number of functions that can be defined is 255.
  25. ;  
  26. ;  (3)  The maximum Number of dynamic Variables that may be used in
  27. ;       a function definition is: 10, i.e., a(1), a(2),...a(10).
  28. ;
  29. ;  (4)  Cell references SHOULD NOT be used in the function definition.
  30. ;       
  31. ;  (5)  Any string to the right of a semicolon ";" is ignored.  This permits
  32. ;       the user to embed comments and function documentation information 
  33. ;       directly in this function definition file.
  34. ;
  35. ;---------------------------------------------------------------------------
  36. ;                       Sample Function Definitions
  37. ;---------------------------------------------------------------------------
  38. ;
  39. ;   ADD1: Simple Function multiplies each of 3 argument by 10 and
  40. ;         sums up the products.  No internal functions used.
  41. ADD1,3
  42. +@a(1)*10+@a(2)*10+@a(3)*10
  43. ;
  44. ;
  45. ;
  46. ;   SUB1: Multiply the First Argument by 100, multiply the second 
  47. ;         argument by 10 and then subtract the second product
  48. ;         from the first.  No internal functions used.
  49. SUB1,2
  50. +@a(1)*100-@a(2)*10
  51. ;
  52. ;
  53. ;-----------------------------------------------------------------------------
  54. ;   The following are sample external functions that make use of
  55. ;   built-in (internal) AS-EASY-AS functions in their definition.
  56. ;-----------------------------------------------------------------------------
  57. ;
  58. ; Calculate the Exponential of a value
  59. ;
  60. COMPLEX1,1
  61. @exp(@a(1))
  62. ;
  63. ;
  64. ; Add the exponential of argument #1 to the 
  65. ; base 10 logarithm of argument #2
  66. ;
  67. COMPLEX2,2
  68. @exp(@a(1))+@log(@a(2))
  69. ;
  70. ;
  71. ; Add the exponential of argument #1, the
  72. ; base 10 logarithm or argument #2 and the
  73. ; natural garithm of argument #3
  74. ;
  75. COMPLEX3,3
  76. @exp(@a(1))+@log(@a(2))+@ln(@A(3))
  77. ;
  78. ;
  79. ; Evaluate the Square Root or the sum of the exponential of 
  80. ; argument #1, the base 10 logarithm or argument #2 and the 
  81. ; natural garithm of argument #3
  82. ;
  83. COMPLEX4,3
  84. @sqrt(@exp(@a(1))+@log(@a(2))+@ln(@A(3)))
  85. ;
  86. ;
  87. ; A slightly more complex function using internal AS-EASY-AS functions
  88. ;
  89. CMP5,5
  90. @sqrt(@exp(@a(1))+@log(@a(2))+@ln(@A(3)))+(@log(@a(4)))^2+@A(5)
  91. ;
  92. ;   
  93. ;
  94. ;
  95. ;-----------------------------------------------------------------------------
  96. ;   The following are simple, useful functions demonstrating
  97. ;   the power of this new feature.
  98. ;-----------------------------------------------------------------------------
  99. ;
  100. ;   TRIAREA: Area of Triangle given Base - a(1), and  Height - a(2) 
  101. ;
  102. TRIAREA,2
  103. (@a(1)/2)*@a(2)
  104. ;
  105. ;
  106. ;   CIRCAREA:  Area of circle given the radius
  107. ;
  108. CIRCAREA,1
  109. +@a(1)^2*(22/7)
  110. ;
  111. ;
  112. ;   INVERSE:  The inverse of a value , i.e., 1/X
  113. ;
  114. INVERSE,1
  115. 1/@A(1)
  116. ;
  117. ;
  118. ;    INTDIV:  Integer Division Var(1)/Var(2).  Var(1) and Var(2) are 
  119. ;             converted to integers before the division! 
  120. ;
  121. INTDIV,2
  122. @int(@int(@a(1))/@int(@a(2)))
  123. ;
  124. ;
  125. ;   RAD2DEG:  Converts the user specified angle from 
  126. ;             Radians to Degrees
  127. ;
  128. RAD2DEG,1
  129. (@A(1)/@PI)*180
  130. ;
  131. ;
  132. ;   DEG2RAD:  Converts the user specified angle from 
  133. ;             Degrees  to Radians
  134. ;
  135. DEG2RAD,1
  136. (@PI*@A(1))/180
  137. ;
  138. ;
  139. ;
  140. ;    CIRCUM:  Calculates the Circumference of a circle given the radius
  141. ;
  142. CIRCUM,1
  143. 2*@PI*@A(1)
  144. ;
  145. ;
  146. ;
  147. ;-----------------------------------------------------------------------------
  148. ;   The following are useful, Bond Calculation Functions.
  149. ;-----------------------------------------------------------------------------
  150. ;
  151. ;    BDISC:     Discount Rate for Bond where,
  152. ;
  153. ;               @A(1)  =  Bond Price 
  154. ;               @A(2)  =  Bond Redemption
  155. ;               @A(3)  =  360 or 365 (Calendar Conversion)
  156. ;               @A(4)  =  Month of Maturity
  157. ;               @A(5)  =  Day of Maturity
  158. ;               @A(6)  =  Year of Maturity
  159. ;               @A(7)  =  Month of Settlement
  160. ;               @A(8)  =  Day of Settlement
  161. ;               @A(9)  =  Year of Settlement
  162. ;
  163. BDISC,9
  164. (1-@A(1)/@A(2))*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
  165. ;
  166. ;-----------------------------------------------------------------------------
  167. ;
  168. ;    BINTR:     Bond Interest Rate where,
  169. ;
  170. ;               @A(1)  =  Bond Redemption
  171. ;               @A(2)  =  Investment
  172. ;               @A(3)  =  360 or 365 (Calendar Conversion)
  173. ;               @A(4)  =  Month of Maturity
  174. ;               @A(5)  =  Day of Maturity
  175. ;               @A(6)  =  Year of Maturity
  176. ;               @A(7)  =  Month of Settlement
  177. ;               @A(8)  =  Day of Settlement
  178. ;               @A(9)  =  Year of Settlement
  179. ;
  180. ;
  181. BINTR,9
  182. ((@A(1)-@A(2))/@A(2))*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
  183. ;
  184. ;-----------------------------------------------------------------------------
  185. ;
  186. ;
  187. ;    BPRICE:     Bond Price where,
  188. ;
  189. ;               @A(1)  =  Bond Face Value
  190. ;               @A(2)  =  Discount
  191. ;               @A(3)  =  360 or 365 (Calendar Conversion)
  192. ;               @A(4)  =  Month of Maturity
  193. ;               @A(5)  =  Day of Maturity
  194. ;               @A(6)  =  Year of Maturity
  195. ;               @A(7)  =  Month of Settlement
  196. ;               @A(8)  =  Day of Settlement
  197. ;               @A(9)  =  Year of Settlement
  198. ;
  199. BPRICE,9
  200. @A(1)*(1-@A(2)*((@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8)))/@A(3)))
  201. ;
  202. ;-----------------------------------------------------------------------------
  203. ;
  204. ;
  205. ;    BRCV:      Bond Redemption Value where,
  206. ;
  207. ;               @A(1)  =  Investment
  208. ;               @A(2)  =  Discount
  209. ;               @A(3)  =  360 or 365 (Calendar Conversion)
  210. ;               @A(4)  =  Month of Maturity
  211. ;               @A(5)  =  Day of Maturity
  212. ;               @A(6)  =  Year of Maturity
  213. ;               @A(7)  =  Month of Settlement
  214. ;               @A(8)  =  Day of Settlement
  215. ;               @A(9)  =  Year of Settlement
  216. ;
  217. ;
  218. BRCV,9
  219. @A(1)/(1-(@A(2)*((@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8)))/@A(3))))
  220. ;
  221. ;-----------------------------------------------------------------------------
  222. ;
  223. ;    BYIELD:    Bond Yield where,
  224. ;
  225. ;               @A(1)  =  Price
  226. ;               @A(2)  =  Redemption
  227. ;               @A(3)  =  360 or 365 (Calendar Conversion)
  228. ;               @A(4)  =  Month of Maturity
  229. ;               @A(5)  =  Day of Maturity
  230. ;               @A(6)  =  Year of Maturity
  231. ;               @A(7)  =  Month of Settlement
  232. ;               @A(8)  =  Day of Settlement
  233. ;               @A(9)  =  Year of Settlement
  234. ;
  235. ;
  236. BYIELD,9
  237. ((@A(2)/@A(1))-1)*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
  238. ;
  239. ;
  240. ;-----------------------------------------------------------------------------
  241. ;-----------------------------------------------------------------------------
  242. ;----------------  END OF SAMPLE EXTERNAL FUNCTION FILE    -------------------
  243. ;-----------------------------------------------------------------------------
  244. ;-----------------------------------------------------------------------------
  245.  
  246.